#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;

class Solution
{
public:
    vector<vector<string>> groupAnagrams(vector<string> &strs)
    {
        unordered_map<string, vector<string>> m;
        for (auto str : strs)
        {
            string s = str;
            sort(s.begin(), s.end());
            m[s].push_back(str);
        }
        vector<vector<string>> res;
        for (auto p : m)
        {
            res.push_back(move(p.second));
        }
        return res;
    }
};

int main()
{
    cout << "Code49" << endl;
    Solution s;
    return 0;
}